package com.systop.scos.news.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.systop.core.model.BaseModel;

/**
 * 新闻类别
 * 
 * @author ShangHua
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "news_types")
public class NewsType extends BaseModel {
	
	/** 主键 */
	private Integer id;

	/** 名称 */
	private String name;
	
	/**
	 * 新闻
	 */
	private Set<News> news = new HashSet<News>(0);

	public NewsType() {
	}

	@Id
	@GeneratedValue(generator = "hibseq")
	@GenericGenerator(name = "hibseq", strategy = "hilo")
	@Column(name = "id", nullable = false)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "Name", length = 255)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@OneToMany(cascade = {}, fetch = FetchType.LAZY, mappedBy = "newsType")
	public Set<News> getNews() {
		return news;
	}

	public void setNews(Set<News> news) {
		this.news = news;
	}
}
